#coding=utf-8

create_comstaticinfo_sql='''
create table if not exists comstaticinfo
    (id int not null primary key auto_increment,
    company_code char(6) not null, code char(6) not null unique, 
    
    bcode char(6),bipo date,
    bondname tinytext, bondcode char(6),
    
    name tinytext not null, englishname tinytext,
    fullname tinytext, englishfullname tinytext,
    
    ipo date,
    
    register_adress tinytext,contact_adress tinytext,
    legal_representative tinytext, secretary tinytext,
    email tinytext,phone tinytext,website tinytext,
    province tinytext,
    
    csrc_bg tinytext, csrc_mg tinytext, csrc_sg tinytext,
    sse_g tinytext,
    
    in180 char(1), is_jwsh char(1), jwsh_adress tinytext);
'''

def get_comstaticinfo(con, code):
    c = con.cursor()
    query_sql=''' 
    select 
        company_code,code,bcode,
        ipo, bipo,bondname, bondcode,
        name, englishname,fullname, englishfullname,
        register_adress,contact_adress,
        legal_representative,secretary,
        email,phone,website,
        csrc_bg,csrc_mg,csrc_sg,sse_g,
        province,in180,is_jwsh, jwsh_adress
    from comstaticinfo where code = %s 
    '''
    c.execute(query_sql, code)
    r = c.fetchone()
    colname =[ i[0] for i in c.description]
    
    c.close()
    if not r:
        return None
    
    return dict(zip(colname,r))